/**********************************************************************************************/
/* FBL_String_Stream.h																		  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006                                        					  */
/* All Rights Reserved.                                                 					  */
/**********************************************************************************************/

#ifndef _FBL_String_Stream_h
	#define _FBL_String_Stream_h
#pragma once

// FBL:
#include <VShared/FBL/publ/Streams/FBL_Text_Stream.h>

// FINAL:
#include <VShared/FBL/publ/Headers/FBL_pre_header.h>


/**********************************************************************************************/
FBL_Begin_Namespace


/**********************************************************************************************/
SMART_CLASS(String_Stream);


/**********************************************************************************************/
// Text mode stream implementation based on UTF-16 encoding.
// (At least in the first implementation).
//
class FBL_SHARED_EXP_CLASS String_Stream : 
	public I_IStream,
	public I_OStream
{
		IMPLEMENT_UNKNOWN(String_Stream)											
		BEGIN_INTERFACE_TABLE(String_Stream)										
			IMPLEMENT_INTERFACE(I_IStream)										
			IMPLEMENT_INTERFACE(I_OStream)										
		END_INTERFACE_TABLE()
 
	public://///////////////////////////////////////////////////////////////////////////////////
	
							String_Stream( String* inString );
							

	public://///////////////////////////////////////////////////////////////////////////////////
	
	// I_Stream:

virtual long             	get_LastError( void ) const throw();
virtual ulong              	get_LastCount( void ) const throw();
virtual flength             get_ByteSize( void ) const throw();
virtual	long				get_Handle( void ) const throw(); 
virtual flength             Seek( 
								flength 	inOffset, 
								ESeekMode 	inMode ) throw();

virtual flength             Tell( void ) const throw();
virtual	void				Flush( void );	
virtual	void				Close( void );	
virtual void                Reset( void );



	public://///////////////////////////////////////////////////////////////////////////////////

	// I_IStream API:

virtual bool                get_Eof( void ) const throw(); 
virtual bool                CanRead( void ) const throw();

virtual I_IStream&          get(  void* 	inBuffer, 
								ulong 	inHowMuch );

virtual I_IStream&          get(I_OStream& streamOut);
virtual I_IStream&			get( bool& outValue );
virtual I_IStream&			get( uchar& outValue );
virtual I_IStream&			get( char& outValue );
virtual I_IStream&			get( short& outValue );
virtual I_IStream&			get( ushort& outValue );
virtual I_IStream&			get( long& outValue );
virtual I_IStream&			get( ulong& outValue );
virtual I_IStream&			get( float& outValue );
virtual I_IStream&			get( double& outValue );
virtual I_IStream&			get( llong& outValue );
virtual I_IStream&			get( ullong& outValue );
virtual I_IStream&          get( UChar* inBuffer, 
								tslen inChars );

	public://///////////////////////////////////////////////////////////////////////////////////

	// Interface I_OStream

virtual I_OStream&          put(  const void* 	inBuffer, 
								ulong 		inHowMuch );

virtual I_OStream&          put( I_IStream& stream_in );
virtual I_OStream&  		put( bool inValue );
virtual I_OStream&			put( uchar inValue );
virtual I_OStream&			put( char inValue );
virtual I_OStream&			put( short inValue );
virtual I_OStream&			put( ushort inValue );
virtual I_OStream&			put( long inValue );
virtual I_OStream&			put( ulong inValue );
virtual I_OStream&			put( float inValue );
virtual I_OStream&			put( double inValue );
virtual I_OStream&			put( llong inValue );
virtual I_OStream&			put( ullong inValue );
virtual I_OStream&			put( const UChar* inString, tslen inLen = -1 );
virtual I_OStream&			put( const char* inString, tslen inLen = - 1 );


	private:////////////////////////////////////////////////////////////////////////////////////

		String*				mpString;

};


/**********************************************************************************************/
FBL_End_Namespace


/**********************************************************************************************/
#include <VShared/FBL/publ/Headers/FBL_post_header.h>


/**********************************************************************************************/
#endif // _FBL_String_Stream_h
